package com.qfly.main.authentication.handler;

import com.qfly.main.common.bean.Result;
import com.qfly.main.common.utils.ResultUtil;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
import org.springframework.stereotype.Component;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Wisdytech.cn
 * com.qfly.main.authentication.handler.qflyLogoutSuccessHandler
 *
 * @author hailin.zhl
 * @date 2018/12/04
 */
@Component
public class QflyLogoutSuccessHandler implements LogoutSuccessHandler {
    @Override
    public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
        Result result = Result.success();
        //TODO 销毁token
        ResultUtil.sendSuccess(request, response, request);
    }
}
